package com.autumn.annotations.transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import java.util.UUID;

/**
 * ClassName: Dao
 *
 * @Description:
 * @Author: wangqiuyang
 * @Date: 2022/1/27 11:15 上午
 * History:
 * <author>          <time>          <version>          <desc>
 * wangqiuyang    2022/1/27 11:15 上午   @Version 1.0        描述
 */
@Component
public class Dao {

    @Autowired
    private JdbcTemplate template;


    public void insert() {
        String sql = "INSERT INTO `user`(name) VALUES(?)";
        String username = UUID.randomUUID().toString().substring(0, 5);
        template.update(sql, username);
    }
}
